home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / VBZ01.ZIP / ~D&DMAIN.BAS next >
BASIC Source File  |  1992-04-27  |  2KB  |  63 lines

  1. DefInt A-Z
  2.  
  3. 'Shell functions
  4. Declare Sub DragAcceptFiles Lib "Shell" (ByVal Wnd, ByVal Accept)
  5. Declare Sub DragFinish Lib "Shell" (ByVal Wnd)
  6. Declare Function DragQueryPoint Lib "Shell" (ByVal hDrop, lpPNT)
  7. Declare Function DragQueryFile Lib "Shell" (ByVal hDrop, ByVal iFile, ByVal lpName$, ByVal BuffSize)
  8.  
  9. 'User Functions
  10. Declare Sub SetWindowPos Lib "User" (ByVal Wnd, ByVal hParent, ByVal X#, ByVal wFlags)
  11. Declare Function PeekMessage Lib "User" (lpMSG, ByVal Wnd, ByVal wMsgFilterMin, ByVal wMsgFilterMax, ByVal wRemoveMsg)
  12.  
  13.  
  14. Const TRUE = -1
  15. Const False = Not TRUE
  16.  
  17. 'SetWindowPos Constants
  18. Const HWND_TOPMOST = -1
  19. Const SWP_NOSIZE = 1
  20. Const SWP_NOMOVE = 2
  21. Const SWP_STATIC = SWP_NOSIZE Or SWP_NOMOVE
  22.  
  23. 'PeekMessage Constants
  24. Const HC_NOREMOVE = 3
  25. Const WM_DROPFILES = 563
  26.  
  27. 'MSG Replacement
  28. Dim MSG(8)
  29. Const HWND = 0
  30. Const WPARAM = 2
  31.  
  32. 'POINT replacement
  33. Dim PNT(1)
  34. Const X = 0
  35. Const Y = 1
  36.  
  37. Dim MyWnd
  38. Dim NameOfFile As String * 128
  39.  
  40. Sub Main ()
  41.     ClientForm.Show
  42.     MyWnd = ClientForm.HWND
  43.     If ClientForm.WindowState = 1 Then
  44.         SetWindowPos MyWnd, HWND_TOPMOST, 0, SWP_STATIC
  45.     End If
  46.     DragAcceptFiles MyWnd, TRUE
  47.     Do While DoEvents()
  48.         Res = PeekMessage(MSG(0), MyWnd, WM_DROPFILES, WM_DROPFILES, HC_NOREMOVE)
  49.         If Res <> 0 Then
  50.             Client = DragQueryPoint(MSG(WPARAM), PNT(0))
  51.             nFiles = DragQueryFile(MSG(WPARAM), -1, NameOfFile, 128)
  52.             ReDim FileArr$(nFiles - 1)
  53.             For FileNum = 0 To nFiles - 1
  54.                 TChars = DragQueryFile(MSG(WPARAM), FileNum, NameOfFile, 128)
  55.                 FileArr$(FileNum) = Left$(NameOfFile, TChars)
  56.             Next FileNum
  57.             DragFinish MSG(WPARAM)
  58.             Form_FileDrop FileArr$(), nFiles, PNT(X), PNT(Y), Client * -1
  59.         End If
  60.     Loop
  61. End Sub
  62.  
  63.